﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections;

namespace Shoozla.DataModel 
{
    public class StatisticsLogger : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public StatisticsLogger()
        {
            Reset();
        }

        public void Reset()
        {
            FilesSaved = 0;
            FilesProcessed = 0;
            CoversFound = 0;
        }

        #region properties
        public int _filesSaved;
        public int FilesSaved
        {
            get { return _filesSaved; }
            set
            {
                lock (this)
                {
                    if (_filesSaved != value)
                    {
                        _filesSaved = value;
                        OnPropertyChanged("FilesSaved");
                    }
                }
            }
        }

        public int _filesProcessed;
        public int FilesProcessed
        {
            get { return _filesProcessed; }
            set
            {
                lock (this)
                {
                    if (_filesProcessed != value)
                    {
                        _filesProcessed = value;
                        OnPropertyChanged("FilesProcessed");
                    }
                }
            }
        }

        public int _coversFound;
        public int CoversFound
        {
            get { return _coversFound; }
            set
            {
                lock (this)
                {
                    if (_coversFound != value)
                    {
                        _coversFound = value;
                        OnPropertyChanged("CoversFound");
                    }
                }
            }
        }
    
        #endregion

        void OnPropertyChanged(string propname)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new
            PropertyChangedEventArgs(propname));
        }

        
        
    }
}
